﻿using Eneta.Portal.Forum.Core.Service.Application;
using Microsoft.SharePoint;

namespace Eneta.Portal.Forum.Core.Service.Builders
{
    public class ForumListBuilder : ListBuilder
    {
        // Methods
        public ForumListBuilder()
        {
            base.listName = "spforums_forums";
        }

        public override void AddFields()
        {
            base.AddFieldToList("CategoryID", (SPFieldType)9, true);
            base.AddFieldToList("Description", (SPFieldType)3, false);
            base.AddFieldToList("SortOrder", (SPFieldType)9, true);
            base.AddFieldToList("TopicCount", (SPFieldType)9, false);
            base.AddFieldToList("PostCount", (SPFieldType)9, false);
        }

        public override void AddSampleData()
        {
            var forum = new Domain.Entities.Forum(1, "Test Forum 1");
            forum.Description = "This is just a test forum, nothing special here.";
            RepositoryRegistry.ForumRepository.Save(forum);
        }
    }
}
